﻿<%@ Assembly Name="zevenseas.ThemeConfig, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4306074270f0265a"%> 
<%@ Page Language="C#" Inherits="zevenseas.ThemeConfig.ApplicationPages.ApplyTheme" MasterPageFile="~/_layouts/application.master"      %> 

<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> 
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 

<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 


<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
	<SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" text="<%$Resources:wss,themeweb_pagetitle%>" EncodeMethod='HtmlEncode'/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
<script language=javascript>
function checkSelection()
{
	var L_alertMsg_MSG = "<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,themeweb_L_alertMsg_MSG%>' EncodeMethod='EcmaScriptStringLiteralEncode'/>";
	index = document.getElementById(<%SPHttpUtility.AddQuote(SPHttpUtility.NoEncode(themes.ClientID),Response.Output);%>).value;
	if(index < 0 || index  >= <% SPHttpUtility.NoEncode(themeIndex,Response.Output); %>)
	{
		alert(L_alertMsg_MSG);
		return;
	}
}
function SetPreview()
{
	var selectList1 = document.getElementById("SelectList1");
	var strImagesUrlPrefix = "images/";
	var cImagesLen = strImagesUrlPrefix.length;
	var selpreviewImage=document.getElementById(<%SPHttpUtility.AddQuote(SPHttpUtility.NoEncode(previewImage.ClientID),Response.Output);%>);
	var imagesrc=selectList1.options[selectList1.selectedIndex].value;
	if (imagesrc != null && imagesrc.length > cImagesLen)
	{
		imagesrc = imagesrc.toLowerCase();
		if (imagesrc.substring(0,cImagesLen) == strImagesUrlPrefix)
			imagesrc = "/_layouts/" + imagesrc;
	}
	selpreviewImage.src = imagesrc;
	selpreviewImage.alt=selectList1.options[selectList1.selectedIndex].getAttribute("alt");
	document.getElementById(<%SPHttpUtility.AddQuote(SPHttpUtility.NoEncode(themes.ClientID),Response.Output);%>).value=selectList1.selectedIndex;
	selectList1.options[document.getElementById(<%SPHttpUtility.AddQuote(SPHttpUtility.NoEncode(themes.ClientID),Response.Output);%>).value].selected=true;
}
function _spBodyOnLoad()
{
	try{document.getElementById("SelectList1").focus();}catch(e){}
	SetPreview();
}
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
	<SharePoint:EncodedLiteral ID="EncodedLiteral2" runat="server" text="<%$Resources:wss,themeweb_pagetitleintitlearea%>" EncodeMethod='HtmlEncode'/>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderId="PlaceHolderPageImage" runat="server">
	<IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt="">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">
	<SharePoint:EncodedLiteral ID="EncodedLiteral3" runat="server" text="<%$Resources:wss,themeweb_pagedescription%>" EncodeMethod='HtmlEncode'/>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderId="PlaceHolderMain" runat="server">
		<TABLE  border="0" cellpadding="0" cellspacing="0" width="100%" id="diidPageOverview">
		<TR><TD colspan="2" class=ms-sectionline height=1><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></TD></TR>
		<TR>
			<TD width="50%">
				<TABLE cellspacing=0 cellpadding=0 height="179px" width="100%" border=0>
					<TR>
						<TD class="ms-sectionheader" >
							<SharePoint:EncodedLiteral ID="EncodedLiteral4" runat="server" text="<%$Resources:wss,themeweb_selecttheme%>" EncodeMethod='HtmlEncode'/>
						</TD>
					</TR>
					<TR>
						<TD class="ms-sectionheader" height="300px" width="60%" align=middle>
							<P><IMG id="previewImage" name="previewImage" alt="<%$Resources:wss,themeweb_PreviewImageAltText%>" src="/_layouts/images/thnone.gif" runat="server"/></P>
								<SharePoint:EncodedLiteral ID="EncodedLiteral5" runat="server" text="<%$Resources:wss,themeweb_preview%>" EncodeMethod='HtmlEncode'/>
							<INPUT type=hidden id="themes" name="themes" value="0" runat="server">
							<INPUT type=hidden id="currentTheme" name="currentTheme" value="none" runat="server">
						</TD>
					</TR>
				</TABLE>
			</TD>
			<TD valign=top align=middle class="ms-authoringcontrols">
			<asp:datalist cellpadding="0" id=lstTemplates DataMember="Templates" runat="server">
			<ItemTemplate>
			<INPUT type=hidden id=ThemeId runat=server value='<%# DataBinder.Eval(Container, "DataItem.TemplateID") %>'>
			<INPUT type=hidden id=ThemeN runat=server value='<%# DataBinder.Eval(Container, "DataItem.DisplayName") %>'>
			<INPUT type=hidden id=Preview runat=server value='<%# DataBinder.Eval(Container, "DataItem.Preview") %>'>
			<INPUT type=hidden id=Description runat=server value='<%# DataBinder.Eval(Container, "DataItem.Description") %>'>
			</ItemTemplate>
			</asp:DataList>
			<SELECT id="SelectList1" name="SelectList1" style="width:90%" align=center size=21 onchange="SetPreview()" title="<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,themeweb_selecttheme%>' EncodeMethod='HtmlEncode'/>">
			<%
			for (int j=0; j < themeIndex ; j++)
			{
				if(j==selectedThemeIndex)
					SPHttpUtility.NoEncode("<option SELECTED value=\"",Response.Output);
				else
					SPHttpUtility.NoEncode("<option value=\"",Response.Output);
				SPHttpUtility.HtmlEncode(sa[j],Response.Output);
				SPHttpUtility.NoEncode("\"",Response.Output);
				SPHttpUtility.NoEncode(" alt=\"",Response.Output);
				SPHttpUtility.HtmlEncode(sd[j],Response.Output);
				SPHttpUtility.NoEncode("\"",Response.Output);
				SPHttpUtility.NoEncode(">",Response.Output);
				SPHttpUtility.HtmlEncode(sb[j],Response.Output);
				SPHttpUtility.NoEncode("</option>",Response.Output);
			}
			%>
			</SELECT>
			</TD>
		</TR>
		</TABLE>
		<TABLE border="0" cellspacing="0" cellpadding="0" class="ms-propertysheet" width="100%">
			<wssuc:ButtonSection runat="server">
				<Template_Buttons>
					<INPUT type=submit class="ms-ButtonHeightWidth" value="<%$Resources:wss,themeweb_apply%>" id=Submit1 name=Submit1 ACCESSKEY="S" OnServerClick="Submit1_Click" onclick="checkSelection()" runat="server"/>
				</Template_Buttons>
			</wssuc:ButtonSection>
		</Table>
</asp:Content>